Ext.define('Jee.model.JeeModel',{
    extend: 'Ext.data.Model',
    alias : ['jeeModel'],
    idProperty: 'id',
    proxy: Ext.create('Jee.data.JeeAjaxProxy',{
    	reader: {
            type: 'json',
            root: 'data',
            successProperty: 'successFlag'
       },
       writer:Ext.create('Jee.data.JsonWriter')
       }),
    load:function(id,config){
	     var me = this;
	     var operation  = Ext.create('Ext.data.Operation', config);
	     operation.action = 'read';
	     var callback = function(operation) {
	    	    var record;
                if (operation.wasSuccessful()) {
                    record = operation.getRecords()[0];
                    Ext.callback(config.success, scope, [record, operation]);
                } else {
                    Ext.callback(config.failure, scope, [record, operation]);
                }
                Ext.callback(config.callback, scope, [record, operation]);
          };
          var jeeRequest = {serviceId:me.serviceId,data:id};
	      operation.jeeRequest = jeeRequest;
          me.proxy.read(operation, callback, me);
    }
});